package com.syni.mdd.sjb.common.datatreaure.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.syni.mdd.sjb.common.component.mybatis.dxshapp.entity.DxshAppFeedback;
import com.syni.mdd.sjb.common.component.mybatis.dxshapp.mapper.DxshAppFeedbackMapper;
import com.syni.mdd.sjb.common.component.utils.common.utils.ResultMapHelper;
import com.syni.mdd.sjb.common.datatreaure.service.DxshAppFeedbackService;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rp.FeedbackVo;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lcc
 * @since 2020-04-29
 */
@Service
public class DxshAppFeedbackServiceImpl extends ServiceImpl<DxshAppFeedbackMapper, DxshAppFeedback> implements DxshAppFeedbackService {

    @Override
    public Map<String, Object> feedback(FeedbackVo feedbackVo) {
        DxshAppFeedback dxshAppFeedback = new DxshAppFeedback();
        dxshAppFeedback.setUserId(feedbackVo.getUserId());
        dxshAppFeedback.setContent(feedbackVo.getContent());
        if(feedbackVo.getScreenshot() != null){
            dxshAppFeedback.setScreenshot(feedbackVo.getScreenshot().toJSONString());
        }
        dxshAppFeedback.setNewTime(LocalDateTime.now());
        this.save(dxshAppFeedback);
        return ResultMapHelper.success(null, "反馈成功");
    }
}
